/**
 * @param {number[]} nums
 * @return {void} Do not return anything, modify nums in-place instead.
 */
var moveZeroes = function (nums) {
  let zero;
  for (let i = 0; i < nums.length; i++) {
    if (nums[i] === 0) {
      zero = i;
      break;
    }
  }
  if (zero === undefined) {
    return;
  }
  for (let i = zero + 1; i < nums.length; i++) {
    if (nums[i] !== 0) {
      nums[zero] = nums[i];
      nums[i] = 0;
      zero++;
    }
  }
};
